#include "onb.h"

onb::onb(const vec3& n)
{
    axis[2] = unit_vector(n);
    vec3 a = (std::fabs(axis[2].x()) > 0.9) ? vec3(0, 1, 0) : vec3(1, 0, 0);
    axis[1] = unit_vector(cross(axis[2], a));
    axis[0] = cross(axis[2], axis[1]);
}
